package coder

import (
	"context"
	"github.com/nats-io/nats.go/micro"
	"net/http"
)

// DecodeHttpRequestFunc

type DecodeHttpRequestFunc func(context.Context, *http.Request) (request interface{}, err error)

// EncodeHttpRequestFunc

type EncodeHttpRequestFunc func(context.Context, *http.Request, interface{}) error

// EncodeHttpResponseFunc

type EncodeHttpResponseFunc func(context.Context, http.ResponseWriter, interface{}) error

// DecodeHttpResponseFunc

type DecodeHttpResponseFunc func(context.Context, *http.Response) (response interface{}, err error)

// EncodeJSONToHttpRequest is an EncodeHttpRequestFunc that serializes the request as a
// JSON object to the Data of the Msg
func EncodeJSONToHttpRequest(_ context.Context, msg micro.Request, request interface{}) error {
	//b, err := json.Marshal(request)
	//if err != nil {
	//	return err
	//}
	//msg.Data = b

	return nil
}
